package com.example.cloudtrade.fragment;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;

import com.example.cloudtrade.JinbiBjBottomSheetFragment;
import com.example.cloudtrade.MyBottomSheetDialogFragment;
import com.example.cloudtrade.R;

public class CompareFragment extends Fragment {

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.activity_compare, container, false);

        // 第一个按钮：显示默认底部sheet
        Button showBottomSheetButton = view.findViewById(R.id.show_bottom_sheet_button);
        showBottomSheetButton.setOnClickListener(v -> showDefaultBottomSheet());

        // 第二个按钮：显示jinbi_bj页面
        Button showBottomSheetButton2 = view.findViewById(R.id.show_bottom_sheet_button_2);
        showBottomSheetButton2.setOnClickListener(v -> showJinbiBottomSheet());

        // 设置Spinner的Prompt文字颜色


        return view;
    }

    // 设置Spinner的Prompt文字颜色


    // 显示默认底部sheet（原逻辑）
    private void showDefaultBottomSheet() {
        MyBottomSheetDialogFragment bottomSheetDialog = MyBottomSheetDialogFragment.newInstance();
        FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
        bottomSheetDialog.show(fragmentManager, "bottomSheet");
    }

    // 显示jinbi_bj页面（新增逻辑）
    private void showJinbiBottomSheet() {
        // 假设jinbi_bj对应的Fragment为JinbiBjBottomSheetFragment
        JinbiBjBottomSheetFragment jinbiBottomSheet = JinbiBjBottomSheetFragment.newInstance();
        FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
        jinbiBottomSheet.show(fragmentManager, "jinbi_bj");
    }
}